package com.rules.admin.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rules.admin.dao.SqlConfigModelDao;
import com.rules.admin.entity.SqlConfigModel;
import com.rules.admin.service.SqlConfigModelService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SqlConfigModelServiceImpl extends ServiceImpl<SqlConfigModelDao, SqlConfigModel> implements SqlConfigModelService {
   public List<SqlConfigModel> selectListByDataSourceId(String datasourceId) {
      LambdaQueryWrapper<SqlConfigModel> queryWrapper = new LambdaQueryWrapper<>();
      queryWrapper.eq(SqlConfigModel::getDatasourceId,datasourceId);
      return this.baseMapper.selectList(queryWrapper);
   }

   public IPage<SqlConfigModel> queryPage(String datasourceId, IPage<SqlConfigModel> page) {
      LambdaQueryWrapper<SqlConfigModel> queryWrapper = new LambdaQueryWrapper<>();
      queryWrapper.eq(SqlConfigModel::getDatasourceId,datasourceId);
      return this.page(page, queryWrapper);
   }
}
